package com.xhgj.thread;

/**
 * @author 周宇
 * @create 2020-06-27 1:57
 * 创建线程方式2
 */
//1、实现Runnable接口
public class PrimeRunable implements Runnable {
    long minPrime;

    PrimeRunable(long minPrime) {
        this.minPrime = minPrime;
    }

    //2、重写run方法
    @Override
    public void run() {
        System.out.println("启动线程" + minPrime);
    }

    public static void main(String[] args) {
        //3、创建线程对象，调用start()方法启动线程
        PrimeRunable p = new PrimeRunable(143);
        new Thread(p, "线1").start();
        new Thread(p, "线2").start();
        new Thread(p, "线3").start();
    }
}
